package com.itboye.zhujia;

import java.util.ArrayList;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.zhujia.adapter.HomeAdapter;
import com.itboye.zhujia.base.BaseFragment;
import com.itboye.zhujia.base.MyApplcation;
import com.itboye.zhujia.bean.HouseBean;
import com.itboye.zhujia.custom.CarouselView;
import com.itboye.zhujia.custom.MyListView;
import com.itboye.zhujia.custom.XScrollView;
import com.itboye.zhujia.home.ActivitySwitchRoles;
/**
 * 首页
 *
 */
public class HomeFragment extends BaseFragment implements OnClickListener{
	private CarouselView banner_top;
	private XScrollView home_scrollView;
	private MyListView home_listview;
	private EditText edit_txt;
	private ArrayList<HouseBean> arrayListHouse=new ArrayList<HouseBean>();
	
	TextView home_qiehuan;//切换角色
	
	RelativeLayout home_city;//切换城市
	RelativeLayout home_sousuo;//搜索
	//智能门锁，签约，预约，商城
	LinearLayout include_01,include_02,include_03,include_04;
	//维修服务，一键缴费，家政服务，签证旅游
	LinearLayout include_weixiu,include_jiaofei,include_jiazheng,include_qianzheng;
	
	private HomeAdapter adapter;
	@Override
	public int initView() {
		return R.layout.fragment_home;
	}

	@Override
	public void onMyActivityCreated() {
		home_listview=(MyListView) getView().findViewById(R.id.mylistview);
		getListViewData();
	}
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		
	}

	private void getListViewData() {
		adapter=new HomeAdapter(getActivity(), arrayListHouse);
		home_listview.setAdapter(adapter);
		for (int i = 0; i < 10; i++) {
			HouseBean bean=new HouseBean();
			arrayListHouse.add(bean);
		}
		adapter.notifyDataSetChanged();
	}

	public void onClick(View arg0) {
		Intent intent=null;
		switch (arg0.getId()) {
		case R.id.home_qiehuan://切换角色
			intent=new Intent(MyApplcation.ctx, ActivitySwitchRoles.class);
			startActivity(intent);
			break;
		case R.id.home_city://切换城市
			
			break;
		case R.id.home_sousuo://搜索
			
			break;
		case R.id.include_01://智能门锁
			
			break;
		case R.id.include_02://我的预约
	
			break;
		case R.id.include_03://我的签约
	
			break;
		case R.id.include_04://积分商城
	
			break;
		case R.id.include_weixiu://朱家维修
			
			break;
		case R.id.include_jiaofei://一键缴费
	
			break;
		case R.id.include_jiazheng://家政服务
	
			break;
		case R.id.include_qianzheng://签约旅行
	
			break;
		default:
			break;
		}
	}

	

}
